<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>10.async和await</title>
        <script type="text/javascript" src="./axios.js"></script>
    </head>
    <body>
        <button id="btn">点我发送请求</button>

        <script type="text/javascript" >
            const btn = document.getElementById('btn')
            btn.onclick = async()=>{
                try {
                    let x1 = await axios.get('http://jsonplaceholder.typicode.com/posts')  
                    console.log('第一次成功了',x1.data)
                    let x2 = await axios.get('http://jsonplaceholder.typicode.com/posts')  
                    console.log('第二次成功了',x1.data)
                    let x3 = await axios.get('http://jsonplaceholder.typicode.com/posts')  
                    console.log('第三次成功了',x1.data)
                } catch (error) {
                    console.log(error)
                }
            }
        </script>
    </body>
</html>